package homework;

import java.util.Scanner;

public class Calculator {
	double num;
	double num2;
	int sum;

	public void showCalculato() {
		switch (sum) {
		case 1:
			System.out.println(num + num2);
			break;
		case 2:
			System.out.println(num - num2);
			break;
		case 3:
			System.out.println(num * num2);
			break;
		case 4:
			System.out.println(num / num2);
			break;

		}

	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Calculator a = new Calculator();
		System.out.println("请输入第一个正整数:");
		a.num = sc.nextDouble();
		System.out.println("请输入第二个正整数:");
		a.num2 = sc.nextDouble();
		System.out.println("请选择算法: 1、加 2、减 3、乘 4、除");
		a.sum = sc.nextInt();
		a.showCalculato();

	}

}
